<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    // Get the URL from the input field
    $url = $_POST['file_url'];
    
    // Generate a unique filename https://trackingvrl.in/ 
    $filename = uniqid('file_') . '.pdf'; // Change the extension based on the file type
    
    // Set the path where you want to save the downloaded file
    $savePath = '/path/to/save/directory/' . $filename;
    
    // Download the file and save it locally
    $result = file_put_contents($savePath, file_get_contents($url));
    
    if ($result !== false) {
        echo 'File downloaded and saved successfully.';
    } else {
        echo 'Error downloading the file.';
    }
}
?>

<!DOCTYPE html>
<html>
<head>
    <title>Download Remote File</title>
</head>
<body>
    <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        <input type="text" name="file_url" placeholder="Enter file URL">
        <button type="submit">Download</button>
    </form>
</body>
</html>
